#-*- encoding:utf-8 -*-
import json
import csv
import requests

def getPost(url, token, data):
    headers = {
        "Content-Type": "application/json"
    }
    if token is not None:
        headers['token'] = token

    response = requests.post(url, headers = headers, data = json.dumps(data))

    if response is None:
        return None
    return response.json()

def getGet(url):
    return requests.get(url).json()

def importUserPass():
    with open(r'./data/login.csv') as csvfile:
        readCSV = csv.reader(csvfile, delimiter=',')
        for row in readCSV:
            yield row